package jmir.oscar.panell.figures;

public class Cercle extends Figura2D {
	
	private final double radi;
	
	//Constructor en el que li pasas el radi
	public Cercle(int coordenadaX, int coordenadaY, double i, Color colorFondo, Color colorBorde, int anchoBorde) {
		super(coordenadaX, coordenadaY, colorFondo, colorBorde, anchoBorde);
		this.radi = i;
		this.coordenadaX = coordenadaX;
		this.coordenadaY = coordenadaY;
	}
	
	public Cercle(Color colorFondo, Color colorBorde, int anchoBorde, int radi ){
		super(colorFondo, colorBorde, anchoBorde);
		this.radi = radi;
	}
	
	public Cercle(double radi){
		super();
		this.radi = radi;
	}
	
	public double getRadi() {
		return radi;
	}
	

	@Override
	public double calculaPerimetre() {
		double perimetre;
		perimetre = getRadi()/2;
		return perimetre;
	}

	@Override
	public double calculaSuperficie() {
		double superficie;
		superficie = 2*Math.PI*getRadi();
		return superficie;
	}

	@Override
	public String toString() {
		return "Cercle [radi=" + radi + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		long temp;
		temp = Double.doubleToLongBits(radi);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Cercle))
			return false;
		Cercle other = (Cercle) obj;
		if (Double.doubleToLongBits(radi) != Double
				.doubleToLongBits(other.radi))
			return false;
		return true;
	}


	
	
}
